package com.abbas.smartCity.adapter;

import android.widget.BaseAdapter;

import java.util.Collections;
import java.util.List;

public abstract class BaseCommAdapter<T> extends BaseAdapter {

    /*适配器数据*/
    private List<T> data = Collections.emptyList();

    public BaseCommAdapter(List<T> data) {
        this.data = data;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    //取得数据
    public List<T> getData() {
        return data;
    }

    //设置数据
    public void setData(List<T> data) {
        this.data = data;
        notifyDataSetChanged();
    }
}
